package com.rdzn.mall.center.service;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.rdzn.mall.center.entity.UmsMemberReceiveAddress;
import com.baomidou.mybatisplus.extension.service.IService;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * @Description: ums_member_receive_address
 * @Author: jeecg-boot
 * @Date:   2020-08-27
 * @Version: V1.0
 */
public interface IUmsMemberReceiveAddressService extends IService<UmsMemberReceiveAddress> {

    /**
     * 修改或新增收货地址
     * @param address 修改的收货地址信息
     */
    @Transactional
    UmsMemberReceiveAddress addOrUpdate(UmsMemberReceiveAddress address);


    /**
     * 添加收货地址
     */
    boolean add(Integer memberId, UmsMemberReceiveAddress address);

    /**
     * 删除收货地址
     * @param id 地址表的id
     */
    boolean delete(Integer memberId, Integer id);

    /**
     * 修改收货地址
     * @param id 地址表的id
     * @param address 修改的收货地址信息
     */
    @Transactional
    boolean update(Integer memberId, Integer id, UmsMemberReceiveAddress address);

    /**
     * 返回当前用户的收货地址
     */
    List<UmsMemberReceiveAddress> list(Integer memberId);

    /**
     * 设置默认地址
     */
    List<UmsMemberReceiveAddress> setDefault(Integer id, Integer memberId);

    /**
     * 获取地址详情
     * @param id 地址id
     */
    UmsMemberReceiveAddress getItem(Integer memberId, Integer id);

}
